/**
 * 
 */
package de.unibi.techfak.msp.eatThis.bean;

/**
 * Bean enthält alle Informationen über die SQL Tabelle Food in der MySQL
 * Datenkbank. Wird via JSON an FrontEnd übertragen.
 * 
 * @author Michael Adams
 * 
 */
public class FoodBean extends GenericBean {

    /** Serial ID. */
    private static final long serialVersionUID = 1L;

    /** Name. */
    private String name;

    /** Gruppe. */
    private String group;

    /** Inhaltsstoffe. */
    private String ingredients;
    /** Fette. */
    private String ean;

    /**
     * Konstruktor für die Serialisierung.
     */
    public FoodBean() {
        super();
    }

    /**
     * Konstruktor für Beans die aus der Datenbak kommen.
     * 
     * @param beanId
     *            Der pk der Bean.
     */
    public FoodBean(final Integer beanId) {
        super(beanId);
    }

    /* (non-Javadoc)
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        FoodBean other = (FoodBean) obj;
        if (ean == null) {
            if (other.ean != null) {
                return false;
            }
        } else if (!ean.equals(other.ean)) {
            return false;
        }
        if (group == null) {
            if (other.group != null) {
                return false;
            }
        } else if (!group.equals(other.group)) {
            return false;
        }
        if (ingredients == null) {
            if (other.ingredients != null) {
                return false;
            }
        } else if (!ingredients.equals(other.ingredients)) {
            return false;
        }
        if (name == null) {
            if (other.name != null) {
                return false;
            }
        } else if (!name.equals(other.name)) {
            return false;
        }
        return true;
    }

    /* (non-Javadoc)
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((ean == null) ? 0 : ean.hashCode());
        result = prime * result + ((group == null) ? 0 : group.hashCode());
        result = prime * result
                + ((ingredients == null) ? 0 : ingredients.hashCode());
        result = prime * result + ((name == null) ? 0 : name.hashCode());
        return result;
    }

    /* (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return "FoodBean [name=" + name + ", group=" + group + ", ingredients="
                + ingredients + ", ean=" + ean + "]";
    }

    /**
     * @return the name
     */
    public final String getName() {
        return name;
    }

    /**
     * @param name
     *            to set
     */
    public final void setName(final String name) {
        this.name = name;
    }

    /**
     * @return the group
     */
    public final String getGroup() {
        return group;
    }

    /**
     * @param group
     *            the group to set
     */
    public final void setGroup(final String group) {
        this.group = group;
    }

    /**
     * @return the ean
     */
    public final String getEan() {
        return ean;
    }

    /**
     * @param ean
     *            to set
     */
    public final void setEan(final String ean) {
        this.ean = ean;
    }

    /**
     * @return the ingredients
     */
    public final String getIngredients() {
        return ingredients;
    }

    /**
     * @param ingredients the ingredients to set
     */
    public final void setIngredients(String ingredients) {
        this.ingredients = ingredients;
    }
}
